{% extends 'base.html' %}

{% block content %}
<a href="{% url 'core:discipline_record_create' %}" class="btn btn-primary mb-3"><i class="bi bi-plus-circle me-2"></i>新增违纪记录</a>
<table class="table table-striped">
    <thead class="table-dark">
        <tr>
            <th>学生</th>
            <th>违纪类型</th>
            <th>时间</th>
            <th>地点</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {% for record in discipline_records %}
        <tr>
            <td>{{ record.student.name }}</td>
            <td>{{ record.discipline_type.name }}</td>
            <td>{{ record.happened_at|date:'Y-m-d H:i' }}</td>
            <td>{{ record.place }}</td>
            <td>
                <a href="{% url 'core:discipline_record_update' record.pk %}" class="btn btn-sm btn-warning"><i class="bi bi-pencil me-1"></i>编辑</a>
                <a href="{% url 'core:discipline_record_delete' record.pk %}" class="btn btn-sm btn-danger"><i class="bi bi-trash me-1"></i>删除</a>
            </td>
        </tr>
        {% empty %}
        <tr><td colspan="5">暂无违纪记录</td></tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}